//
//  AblumModel.m
//  CarHome
//
//  Created by 蒋寒霄 on 14-9-23.
//  Copyright (c) 2014年 WJN_work@163.com. All rights reserved.
//

#import "AblumModel.h"

@implementation AblumModel
- (void)dealloc
{
    [_ablum_categorys release];
    _ablum_categorys = nil;
    [_ablum_list release];
    _ablum_list = nil;
    [super dealloc];
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.ablum_categorys = [[[NSMutableArray alloc] init] autorelease];
        self.ablum_list = [[[NSMutableArray alloc] init] autorelease];
    }
    return self;
}

+ (AblumModel *)returnAblumModel:(NSMutableDictionary *)dic
{
    AblumModel *model = [[AblumModel alloc] init];
    model.ablum_rowcount = [dic objectForKey:@"rowcount"];
    model.ablum_index = [dic objectForKey:@"index"];
    for (NSDictionary *dicCategorys in [dic objectForKey:@"categorys"]) {
        AblumCategory *ablumCategory = [[AblumCategory alloc] init];
        ablumCategory.ablum_id = [dicCategorys objectForKey:@"id"];
        ablumCategory.ablum_name = [dicCategorys objectForKey:@"name"];
        ablumCategory.ablum_picCount = [dicCategorys objectForKey:@"piccount"];
        [model.ablum_categorys addObject:ablumCategory];
        [ablumCategory release];
    }
    for (NSDictionary *dicList in [dic objectForKey:@"list"]) {
        AblumList *ablumImage = [[AblumList alloc] init];
        ablumImage.ablum_imageID = [dicList objectForKey:@"id"];
        ablumImage.ablum_imgUrl = [dicList objectForKey:@"imgurl"];
        [model.ablum_list addObject:ablumImage];
        [ablumImage release];
    }
    return model;
}

@end
